#!/bin/bash

###
### Starts the database and Glassfish server, which have to be installed
### using the setup script. The application was already deployed using 
### the setup script. You need to execute the start script from the same
### working directory as the setup script. 
###
### @Author: Florian Sieck
###

echo "Starting the server."

if [ -d SimSearch1 ]
then
  pushd SimSearch1 > /dev/null
  if [ -d mysql ] && [ -d glassfish4 ]
  then
    pushd mysql > /dev/null
    ./bin/mysqld_safe --defaults-file=".my.cnf" &
    popd > /dev/null
    ./glassfish4/glassfish/bin/asadmin start-domain 
  else
    echo "There is no SimSearch1 folder. Did you execute the setup script?"
  fi
  popd > /dev/null
else
  echo "There is no SimSearch1 folder. Did you execute the setup script?"
fi
